package cn.lyp.feignclient;

import cn.lyp.domain.Store;
import cn.lyp.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 降级
 */
@Component
public class StoreFeignFallBackFactory implements FallbackFactory<IStoreFeignClient> {
    @Override
    public IStoreFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new IStoreFeignClient() {
            @Override
            public AjaxResult add(Store store) {
                return new AjaxResult(false,"网络异常");
            }

        };
    }
}
